feat: add syntax highlighting for diff code using emphasize#79
Open
watany-dev wants to merge 2 commits intomainfrom
Open
feat: add syntax highlighting for diff code using emphasize#79watany-dev wants to merge 2 commits intomainfrom
watany-dev wants to merge 2 commits intomainfrom
Conversation
Implement language-aware syntax highlighting for diff lines in the TUI. The prefix (+/-/space) retains its diff color while code content gets token-level coloring via the emphasize library (highlight.js wrapper). - Add highlightCode utility: language detection from file extension, ANSI-to-segment parser, and highlightLine function - Modify DiffLine to render highlighted segments for add/delete/context - Support 37 common languages (TypeScript, Python, Go, Rust, etc.) - Pure JS, no native dependencies (CloudShell compatible) - 26 unit tests for highlighting, 14 for DiffLine rendering https://claude.ai/code/session_014NYVEWAyfKd44Ah4QroxBs
b5ef91d to
54d8c1b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement language-aware syntax highlighting for diff lines in the TUI.
The prefix (+/-/space) retains its diff color while code content gets
token-level coloring via the emphasize library (highlight.js wrapper).
ANSI-to-segment parser, and highlightLine function
https://claude.ai/code/session_014NYVEWAyfKd44Ah4QroxBs